
//安全帽模块
const { ethers, upgrades } = require("hardhat");
// 代理合约地址
const proxyAddress = "0xF78541639BE0d035e7704F6ae8b3185f0890E63e";

async function main() {
  console.log(proxyAddress, " original proxy address");
  // 部署新合约
  const EUROCashV2 = await ethers.getContractFactory("EUROCashV2");
  console.log("upgrade to EUROCashV2...");
  const myEUROCashV2 = await upgrades.upgradeProxy(proxyAddress, EUROCashV2);

  const myEUROCashV2Address = myEUROCashV2.target;
  console.log(myEUROCashV2Address, " EUROCashV2 address(should be the same)");

  console.log(
    await upgrades.erc1967.getImplementationAddress(myEUROCashV2Address),
    " getImplementationAddress"
  );
  console.log(
    await upgrades.erc1967.getAdminAddress(myEUROCashV2Address),
    " getAdminAddress"
  );
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });
